<?php

declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class CreateChickenCardsTable extends AbstractMigration
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change(): void
    {
        $table = $this->table('chicken_cards');
        $table
            ->addColumn('green_card_1', 'integer')
            ->addColumn('green_card_2', 'integer')
            ->addColumn('green_card_3', 'integer')
            ->addColumn('green_card_4', 'integer')
            ->addColumn('green_card_5', 'integer')
            ->addColumn('blue_card_1', 'integer')
            ->addColumn('blue_card_2', 'integer')
            ->addColumn('gold_card_1', 'integer')
            ->addColumn('red_card_1', 'integer')
            ->addColumn('black_card_1', 'integer')
            ->addColumn('is_sold_out', 'boolean')
            ->addColumn('green_card_1_draw_rate', 'decimal', ['precision' => 5, 'scale' => 2])
            ->addColumn('green_card_2_draw_rate', 'decimal', ['precision' => 5, 'scale' => 2])
            ->addColumn('green_card_3_draw_rate', 'decimal', ['precision' => 5, 'scale' => 2])
            ->addColumn('green_card_4_draw_rate', 'decimal', ['precision' => 5, 'scale' => 2])
            ->addColumn('green_card_5_draw_rate', 'decimal', ['precision' => 5, 'scale' => 2])
            ->addColumn('blue_card_1_draw_rate', 'decimal', ['precision' => 5, 'scale' => 2])
            ->addColumn('blue_card_2_draw_rate', 'decimal', ['precision' => 5, 'scale' => 2])
            ->addColumn('gold_card_1_draw_rate', 'decimal', ['precision' => 5, 'scale' => 2])
            ->addColumn('red_card_1_draw_rate', 'decimal', ['precision' => 5, 'scale' => 2])
            ->addColumn('black_card_1_draw_rate', 'decimal', ['precision' => 5, 'scale' => 2])
            ->addColumn('eggs_per_card', 'integer')
            ->addColumn('eggs_directly_get', 'integer')
            ->addColumn('return_fund_percentage', 'decimal', ['precision' => 5, 'scale' => 2])
            ->addColumn('created_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP'])
            ->addColumn('updated_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'update' => 'CURRENT_TIMESTAMP'])
            ->save();
    }
}
